package com.fastCms.manager.bim.controller.api;

import com.fastCms.business.bim.manage.PollutionManageService;
import com.fastCms.business.bim.pojo.po.PollutionPO;
import com.fastCms.business.bim.pojo.vo.CemsVO;
import com.fastCms.business.bim.pojo.vo.NameAndNumVO;
import com.fastCms.business.bim.pojo.vo.PollutionChartVO;
import com.fastCms.business.bim.pojo.vo.PollutionVO;
import com.fastCms.business.frame.pojo.PageParam;
import com.fastCms.business.frame.response.ApiResponse;
import com.fastCms.manager.frame.annotation.UserAccess;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 排放源表 前端控制器
 * </p>
 *
 * @author liusq
 * @since 2021-07-07
 */

@RestController
@RequestMapping("api/pollution")
@Api(value = "ApiPollutionController", tags = "前端-排放源管理")
@UserAccess
public class ApiPollutionController {
    @Autowired
    private PollutionManageService pollutionManageServiceImpl;

    @ApiOperation(value = "首页-排放源头清单管理数量饼图", notes = "首页饼图")
    @GetMapping("/index/numChart")
    public ApiResponse<List<NameAndNumVO>> numChart() {
        ApiResponse<List<NameAndNumVO>> detail = pollutionManageServiceImpl.numChart();
        return detail;
    }

    @ApiOperation(value = "排放源头清单管理", notes = "三个菜单通用")
    @PostMapping("/showList")
    public ApiResponse<PageInfo<PollutionVO>> showList(@RequestBody PageParam<PollutionPO> pageParam) {
        ApiResponse<PageInfo<PollutionVO>> detail = pollutionManageServiceImpl.showList(pageParam);
        return detail;
    }

    @ApiOperation(value = "获取排放源详情(基本信息)", notes = "")
    @GetMapping("/getDetail/{id}")
    public ApiResponse<PollutionVO> getDetail(@PathVariable Integer id) {
        ApiResponse<PollutionVO> detail = pollutionManageServiceImpl.getDetail(id);
        return detail;
    }

    @ApiOperation(value = "获取数据源详情", notes = "三个菜单通用")
    @GetMapping("/getChartDetail/{id}")
    public ApiResponse<List<PollutionChartVO> > getChartDetail(@PathVariable Integer id) {
        ApiResponse<List<PollutionChartVO> > detail = pollutionManageServiceImpl.getChartDetail(id);
        return detail;
    }

    @ApiOperation(value = "获取有组织检测数据", notes = "三个菜单通用")
    @GetMapping("/getCemsList")
    public ApiResponse<List<CemsVO> > getCemsList() {
        ApiResponse<List<CemsVO> > detail = pollutionManageServiceImpl.getCemsList();
        return detail;
    }

}

